wayland: check for support of xdg_shell interface
authorOlivier Fourdan <ofourdan@redhat.com>
Thu, 18 Feb 2016 11:00:23 +0000 (12:00 +0100)
committerOlivier Fourdan <ofourdan@redhat.com>
Thu, 18 Feb 2016 14:29:01 +0000 (15:29 +0100)
When running with a Wayland compositor which doesn't support the
xdg_shell interface, gtk+ will segfault while trying to access the
corresponding wl proxy.

Check for xdg_shell support and do not use Wayland if not present, so
that it can fallback to X11, hoping that Xwayland is usable.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762258

gdk/wayland/gdkdisplay-wayland.c

index db02c73d8433ee834e26b1a1dc87f1e1ba95506a..9577d10ec88efbc0397dc9105e594c6ff081a870 100644 (file)
@@ -444,6 +444,16 @@ _gdk_wayland_display_open (const gchar *display_name)
         }
     }
 
+  /* Make sure we have xdg_shell at least */
+  if (display_wayland->xdg_shell == NULL)
+    {
+      g_warning ("Wayland compositor does not support xdg_shell interface,"
+                 " not using Wayland display");
+      g_object_unref (display);
+
+      return NULL;
+    }
+
   gdk_input_init (display);
 
   display_wayland->selection = gdk_wayland_selection_new ();